// Copyright 2011 Jay Young. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * @fileoverview
 *
 * Provides the URL Map for the Relief Blog application.
 */

goog.provide('rb.urlMap');


goog.require('rb.auth.pageConfigs.login');
goog.require('rb.auth.pageConfigs.logout');
goog.require('rb.handlers.BrowseHandler');
goog.require('rb.handlers.LandingHandler');
goog.require('rb.handlers.PostHandler');
goog.require('rb.handlers.PublishHandler');
goog.require('rb.labs.LabsHandler');

goog.require('relief.handlers.MessageHandler');
goog.require('relief.handlers.templates');
goog.require('relief.handlers.errors');
goog.require('relief.nav.URLMap');


/**
 * @type {relief.nav.URLMap}
 */
rb.urlMap = {
  // Home page
  '': rb.handlers.LandingHandler,
  '/': rb.handlers.LandingHandler,

  // Authentication handlers
  '/auth/login': rb.auth.pageConfigs.login,
  '/auth/logout': rb.auth.pageConfigs.logout,

  // Admin pages
  '/admin/post': rb.handlers.PublishHandler,
  '/admin/members': null,

  // Handlers for browsing and reading blog posts
  '/posts': rb.handlers.BrowseHandler,
  '/post': rb.handlers.PostHandler,

  // Handlers for community pages
  '/members/me': null,
  '/members/profiles': null,
  '/comments': null,

  // A playground handler for trying stuff out
  '/labs': rb.labs.LabsHandler,

  // Use the generic error handlers provided by Relief
  ':401': relief.handlers.errors.Error401,
  ':404': relief.handlers.errors.Error404,
  ':501': {
            handler: relief.handlers.MessageHandler,
            message: {
              template: relief.handlers.templates.genericError,
              templateParams: {
                header: 'Not Yet Implemented',
                details: 'This space intentionally left blank.'
              }
            }
  }
};
